package com.mirzabros.chexmo.service;

import java.io.InputStream;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.util.Log;
import android.widget.BaseAdapter;
import android.widget.ImageView;

public class Chexmo_Load_Image extends AsyncTask<String, Void, Bitmap>{

	ImageView myImage;
	String passurl;
	BaseAdapter adapter;

    public Chexmo_Load_Image(ImageView bmImage) {
        this.myImage = bmImage;
    }
    
    @Override
    protected void onPreExecute() {
    	super.onPreExecute();
    	myImage.setImageBitmap(null);
    }

    protected Bitmap doInBackground(String... urls) {
        String urldisplay = urls[0];
        this.passurl = urls[0];
        Bitmap mIcon11 = null;
        try {
            InputStream in = new java.net.URL(urldisplay).openStream();
            mIcon11 = BitmapFactory.decodeStream(in);
        } catch (Exception e) {
            Log.e("Error", e.getMessage());
            e.printStackTrace();
        }
        return mIcon11;
    }

    protected void onPostExecute(Bitmap result) {

    	if (result != null){
    		myImage.setImageBitmap(result);
    	}
    	
    }
}
